package com.dayaokeji.rhythmschoolstudent.wiget.adapter

import android.text.TextUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.dayaokeji.rhythmschoolstudent.R
import com.dayaokeji.rhythmschoolstudent.client.common.base.common.remoteImageUrl
import com.dayaokeji.rhythmschoolstudent.glide.GlideUrlModel
import com.dayaokeji.rhythmschoolstudent.glide.GlideUtils
import com.dayaokeji.server_api.domain.Member
import com.dayaokeji.server_api.domain.UserInfo

/**
 *********************************************************************
 **  Created by Zeno on 2018/7/30
 *********************************************************************
 **  version 1.0
 *********************************************************************
 **  Copyright (C) dayaokeji.com 2018 -- 2020 All rights reserved.
 *********************************************************************
 **
 *********************************************************************
 */
class AddMembersAdapter: BaseQuickAdapter<Member,BaseViewHolder>(R.layout.item_add_member_avatar,null) {

    override fun convert(helper: BaseViewHolder?, item: Member?) {
        if (item?.localAvatar != -1) {
            helper?.setImageResource(R.id.iv_avatar,item?.localAvatar!!)
        }else{
            if (TextUtils.isEmpty(item.resourceId)) {
                helper?.setImageResource(R.id.iv_avatar,R.mipmap.default_avatar)
            }else{
                GlideUtils.with(mContext).load(GlideUrlModel(remoteImageUrl+ item.resourceId)).into(helper?.getView(R.id.iv_avatar)!!)
            }
        }
    }
}